function getDate()
{
    window.setTimeout(function(){
        window.requestAnimationFrame(getDate)
    },1000/2)
    var d=new Date();
    var year=d.getFullYear()  //获取年
    var month=d.getMonth()+1;  //获取月，从 Date 对象返回月份 (0 ~ 11)，故在此处+1
    var day=d.getDay()    //获取日
    var days=d.getDate() //获取日期
    var hour=d.getHours()   //获取小时
    var minute=d.getMinutes()  //获取分钟
    var second=d.getSeconds()   //获取秒
    if(month<10) month="0"+month
    if(days<10) days="0"+days
    if(hour<10) hour="0"+hour
    if(minute<10) minute="0"+minute
    if(second<10) second="0"+second
    var week=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六")
    var Tools=document.getElementById("Main")
    var da=year+" 年 "+month+" 月 "+days+" 日 "+week[day]+" "+hour+" : "+minute+" :"+second
    Tools.innerHTML=da
}
function showFlight(){
    $.get("FlightServlet?method=show",function (date) {
        $("#div1").html(date);
    })
    document.getElementById("div2").style.display="none"
}
function showPersonal(){
    $.get("PersonalServlet?method=show",function (date) {
        $("#div1").html(date);
    })
    document.getElementById("div2").style.display="none"
}

function showPurchase(){
    $.get("PurchaseServlet?method=show",function (date) {
        $("#div1").html(date);
    })
    document.getElementById("div2").style.display="none"
}

function del_purchase(id){
    layer.confirm('您确定要删除吗？', {
        btn: ['确定','取消'] //按钮
    }, function(){
        $.get("PurchaseServlet?method=delete&id="+id,function (date){
            $("#div1").html(date);
        });
        layer.msg('删除成功', {icon: 1});
    }, function(){
        layer.msg('正在取消', {
            time: 1500, //20s后自动关闭
        });
    });
}
function toupdate_personal(id){
    layer.open({
        type: 2,
        title:'修改页面', //不显示标题栏
        closeBtn:1,
        area :['50%','50%'],
        shade: 0.6, // 0-1越接近1越不透明
        moveType: 1, //拖拽模式，0或者1
        maxmin:true,
        content: 'PersonalServlet?method=toupdate&id='+id,
        end: function () {showPersonal();}
    });
}
function toupdate_flight(id){
    layer.open({
        type: 2,
        title:'修改页面', //不显示标题栏
        closeBtn:1,
        area :['50%','50%'],
        shade: 0.6, // 0-1越接近1越不透明
        moveType: 1, //拖拽模式，0或者1
        maxmin:true,
        content:'FlightServlet?method=toupdate&id='+id,
        end: function () {showFlight();}
    });
}

function toadd_flight() {
    layer.open({
        type: 2,
        title:'添加页面', //不显示标题栏
        closeBtn:1,
        area :['50%','50%'],
        shade: 0.6, // 0-1越接近1越不透明
        moveType: 1, //拖拽模式，0或者1
        maxmin:true,
        content:'flight/add.jsp',
        end: function () {showFlight();}
    });
}
function del_flight(id){
    layer.confirm('您确定要删除吗？', {
        btn: ['确定','取消'] //按钮
    }, function(){
        $.get("FlightServlet?method=delete&id="+id,function (date){
            $("#div1").html(date);
        });
        layer.msg('删除成功', {icon: 1});
    }, function(){
        layer.msg('正在取消', {
            time: 1500,
        });
    });
}
function close2(){
    parent.layer.close(parent.layer.getFrameIndex(window.name));
}
